package task;

import appapi.service.IAlarmledgerService;
import appapi.service.MonthinspectionService;
import appapi.service.impl.AlarmledgerServiceImpl;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 请求对象
 *
 * @author luocheng
 * @version 1.0
 * @date 2023/06/07 20:33
 */
@EnableAsync
@Component
@EnableScheduling
public class MonthCheckTask {
    @Autowired
    MonthinspectionService monthinspectionService;
    //@Scheduled(fixedRate = 30000)
    @Scheduled(cron = "0 30 20 * * ?")
    public void runAlitask() throws Exception {
        //定时执行月检分析
        DateTime currentTime = new DateTime();
        DateTime newTime = currentTime.minusDays(1);
        String alipayBillDate = newTime.toString("yyyy-MM-dd");
        try {
            //分析设备月检告警、预警
            monthinspectionService.AnaluEquipMonthAlarm();
        } catch (Exception e) {

        }
    }
}
